package pro.cherish.nettyJpa.sql.Device;


import com.google.common.util.concurrent.ListenableFuture;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;
import pro.cherish.nettyJpa.device.DeviceDao;
import pro.cherish.nettyJpa.domain.Device;
import pro.cherish.nettyJpa.entity.sql.DeviceEntity;
import pro.cherish.nettyJpa.sql.JpaAbstractDao;
import pro.cherish.nettyJpa.util.SqlDao;

import java.util.List;

@Component
@SqlDao
public class JpaDeviceDao extends JpaAbstractDao<DeviceEntity, Device> implements DeviceDao {

    @Autowired
    private DeviceRepository deviceRepository;

    @Override
    protected Class<DeviceEntity> getEntityClass() {
        return DeviceEntity.class;
    }

    @Override
    protected CrudRepository<DeviceEntity, Long> getCrudRepository() {
        return deviceRepository;
    }

    @Override
    public List<Device> find() {
        return super.find();
    }

    @Override
    public Device findById(Long id) {
        return super.findById(id);
    }

    @Override
    public ListenableFuture<Device> findByIdAsync(Long id) {
        return super.findByIdAsync(id);
    }

    @Override
    public Device save(Device domain) {
        return super.save(domain);
    }

    @Override
    public boolean removeById(Long id) {
        return super.removeById(id);
    }


}
